<html>
 <head>
    <title>[var.TITLE]</title>
    <link href="[var.ROOT_CSS_DIR]/main.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
    <link href="[var.ROOT_CSS_DIR]/facet/style.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
 		<script type="text/javascript" src="[var.ROOT_DIR]js/jsmasks.js"></script>
 </head>
 <body bgcolor="FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
    <table border="0" cellspacing="0" cellpadding="0" width="100%" align="[var.POSITION]">
        <tr height="100%">
            <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
                <tr valign="top">
                    <td width="100%">
                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                            <tr>
                                <td class="FacetHeaderContent" align="left">.:Activity Lookup:. </td>
                            </tr>
                        </table>
                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                            <tr>
                                <td class="content2">
                                    <table border="0" cellspacing="0" cellpadding="0">
                                    <form  method="post" action="[var.FileName]?FormName=[var.FormName]&[var.PreserveGet]">
                                        <tr>
                                            <td class="fieldCaption">Activity Code</td>
                                            <td class="fieldCaption">:</td>
                                            <td>
                                            <input type="text" name="codeSearch" size="10" maxlength="50" class="input" value="[var.FCode]">
                                                                                                                                                                                                    <input type="hidden" name="SendToBack" value="1">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="fieldCaption">Activity Name</td>
                                            <td class="fieldCaption">:</td>
                                            <td>
                                            <input type="text" name="nameSearch" size="35" maxlength="50" class="input" value="[var.FNama]">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="menuHeader"></td>
                                            <td class="menuHeader"></td>
                                            <td align="right">
                                            <!--input type="button" value="Add New" class="button" onclick="AddNew();"-->
                                            <input type="submit" name="Action" value="Search" class="button" >
                                            </td>
                                        </tr>
                                    </form>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td >&nbsp;</td>
                            </tr>
                        </table>
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                            <tr>
                              <td>
                         <!-- GRID SECTION -->
                                    <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">
                                    <form method=post name="[var.HTMLGridList]" >
                                      <tr>
                                        <td nowrap class="FacetColumnTD" align="center">No.</td>
                                        <td nowrap class="FacetColumnTD" align="center">BS Code</td>
                                        <td nowrap class="FacetColumnTD" align="center">Amount</td>
                                      </tr>

                                      <tr>
                                        <td nowrap class="FacetDataTD">[blg.#]</td>
                                        <td class="FacetDataTD"><a href="javascript:GetBS('[blg.adv_id]','[blg.nobs]','[blg.tglbkt]', '[blg.jumlah]', '[blg.rupiah]');">[blg.nobkt]</a></td>
                                        <td class="FacetDataTD">[blg.jumlah;noerr;frm='0,000.00';block=tr;]</td>
                                      </tr>

                                      <tr>
                                        <td colspan="8" class="FacetDataTD">[blg;block=tr;nodata]No records</td>
                                      </tr>

                                      <tr>
                                        <td colspan="8" nowrap class="FacetColumnTD">[tbs_check.1;block=tr;if [var.RecCnt]!=0]
                                            <table border="0" align="left" cellpadding="0" cellspacing="0">
                                              <tr align="center">[tbs_check.1;block=table;if [var.RecCnt]!=0]
                                                <td width="16" class="FacetColumnTD"><a href="[sys.script_name]?PageNum=[nv.first;endpoint;friend2=a]&[var.PreserveGet]">|&lt;</a></td>
                                                <td width="16" class="FacetColumnTD"><a href="[sys.script_name]?PageNum=[nv.prev;endpoint;friend2=a]&[var.PreserveGet]">&lt;</a></td>
                                                <td width="16" class="FacetColumnTD"><a href="[sys.script_name]?PageNum=[nv.page;block=td]&[var.PreserveGet]">[nv.page]</a></td>
                                                <td width="16" bgcolor="#B7B3B7"><strong>[nv.page;block=td;currpage]</strong></td>
                                                <td width="16" class="FacetColumnTD"><a href="[sys.script_name]?PageNum=[nv.next;endpoint;friend2=a]&[var.PreserveGet]">&gt;</a></td>
                                                <td width="16" class="FacetColumnTD"><a href="[sys.script_name]?PageNum=[nv.last;endpoint;friend2=a]&[var.PreserveGet]">&gt;|</a></td>
                                              </tr>
                                            </table>
                                        </td>
                                      </tr>
                                      </form>
                                    </table>
                        <!-- GRID SECTION -->
                               </td>
                            </tr>
                            <tr>
                              <td>

                              &nbsp;
                              </td>
                            </tr>
                            </table>
                    </td>
                </tr>
            </table>

            </td>
        </tr>
    </table>
 </body>
<script>
 var Address;
 var NPWP;

 function SetOther(addr,npwp) {
    Address = addr;
    NPWP = npwp;
 }

 function GetBS(adv_id,nobkt,tglbkt,jumlah,rupiah) {
 var BufferOpener;
 var no_urut = [var.no_urut];
		 
		 oMask = new Mask('#,###.#0', 'number');
		 var maskJumlah = oMask.format(jumlah);
		 
     oMask = new Mask('#,###.#0', 'number');
		 var maskRupiah = oMask.format(rupiah);
     BufferOpener = window.opener.document.body.innerHTML;
		 
		 var total = 0;
		 
		 // COUNT BS PLANNING & TOTAL BS PLANNING --- START
		 for(i=1;i<=20;i++){
        eval("var TotalBS = window.opener.document.[var.FormName].rupiah"+i+".value");

        if(TotalBS == "") {
            TotalAmount = 0;
        }

        TotalBS = String(TotalAmount);
        TotalBS = (TotalBS.replace(/,/g, "")) * 1;
        
        total = total + TotalBS;

            //alert("TotalAmount: " + TotalAmount);
    }	
    		
    		rupiah = String(rupiah);
    	  rupiah = (rupiah.replace(/,/g, "")) * 1;
    		
    		total = total + rupiah;
        //alert("total: " + total);
        
        var maskTotalAmount = oMask.format(total);
    		window.opener.document.[var.FormName].bspl_idr.value = maskTotalAmount;
    		
    		// COUNT BS PLANNING & TOTAL BS PLANNING --- END	
    		
    		
    		// COUNT MARGIN START
    		eval("var bsac = window.opener.document.[var.FormName].bsac_idr.value");
				
				if (bsac == ""){
					bsac = 0;
				}
				
				bsac = String(bsac);
    	  bsac = (bsac.replace(/,/g, "")) * 1;
				
				margin = total - bsac;
				
				margin = String(margin);
    	  margin = (margin.replace(/,/g, "")) * 1;
    	  
    	  var maskMargin = oMask.format(margin);
    		window.opener.document.[var.FormName].bsmg_idr.value = maskMargin;
				// COUNT MARGIN END
			
     if(no_urut != "")
     {
         window.opener.document.[var.FormName].adv_id[var.no_urut].value = adv_id;
         window.opener.document.[var.FormName].adv_code[var.no_urut].value = nobkt;
         window.opener.document.[var.FormName].adv_date[var.no_urut].value = tglbkt;
     		 window.opener.document.[var.FormName].jumlah[var.no_urut].value = maskJumlah;
     		 window.opener.document.[var.FormName].rupiah[var.no_urut].value = maskRupiah;
     }

     else
     {
         window.opener.document.[var.FormName].act_nr_id.value = act_nr_id;
         window.opener.document.[var.FormName].actcode.value = actcode;
         window.opener.document.[var.FormName].actname.value = actname;
     }

     self.close();
 }

 function AddNew() {
    self.location.replace('ais_transaction_debtur.php?PageMode=Form');
 }
</script>
</html>
